﻿<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>JavaScriptLearn</title>
<script type="text/javascript">
var phone = "13488121965";
var phone2="029-86100229";
var phone3="029";
//手机号验证
var mobile = /^1[3|5|8]\d{9}$/;
//座机号码验证
var sitPhone = /^0\d{2,3}-?\d{7,8}$/;
var b1 = !mobile.test(phone);
var b2 = !sitPhone.test(phone);
document.write(b1+"<br>"+b2); 
if( (!mobile.test(phone3)) || (!sitPhone.test(phone3)) ){
    alert(b1+"\n"+b2);
    //alert(mobile.test(phone3)+"==="+sitPhone.test(phone3));//true false
}	
</script>	
</head>
<body>
</body>

</html>